<?php

/******************************************
 * File:			lib_stats.php
 * Version:			1.0.0
 * Last modified:	25/10/2009
 * Last modifier:	Hugo Lavigne
 *****************************************/
 
Function add_stats_ip($ip)
{
	$table_stats_ip = $_SESSION['prefix'].'stats_ip';
	$connection = dbconnect();
	$req = dbquery("SELECT ip FROM $table_stats_ip WHERE 1", $connection);
	
	while ($line = @mysql_fetch_array($req))
	{
		if ($line['ip'] == $ip)
		{
			mysql_close($connection);
			return (0);
		}
	}
	
	$date = date('Y-m-d H:i:s');
	
	$nid = create_mysql_id($table_stats_ip, 'id', $connection);
	$req = dbquery("INSERT INTO odt_stats_ip VALUES($nid, '$ip', '$date')", $connection);
	mysql_close($connection);
	return (0);
}

?>